<?php
/**
 * Created by PhpStorm.
 * User: skytop
 * Date: 2016/7/19
 * Time: 7:14
 */

namespace Home\Model;


use Think\Model;

class BoardModel extends Model
{
    protected $trueTableName='hd_wish';

    protected $_validate=array(
        array('content','','不能重复内容',0,'unique',3),
        array('username','require','请填写昵称'),
        array('content','require','内容不能为空')
    );

    /**
     * [添加信息]
     * @param $username 昵称
     * @param $content  内容
     * @param $time     时间戳
     * @return bool|mixed
     */
    public function addMsg($username,$content,$time){
        $data['username']=$username;
        $data['content']=$content;
        $data['time']=$time;

        if($this->create($data)){
            return $this->add();
        }else{
            return false;
        }
    }
}